import java.util.Scanner;

public class Main {
    public static void main(String[] args) {    //循环读取n个数字求和求平均值
        Scanner sc = new Scanner(System.in);
        int sum = 0;
        int num = 0;
        while (sc.hasNextInt()) {
            int temp = sc.nextInt();
            sum += temp;
            num++;
        }
        System.out.println("sum = " + sum);
        System.out.println("average = " + sum / num);
        sc.close();
    }
    public static void main3(String[] args) {
        Scanner scan = new Scanner(System.in);

        System.out.println("输入一个整数: ");
        int age = scan.nextInt();
        System.out.println("年龄: " + age);

        scan.nextLine();//消除上一个sout的回车,否则这个回车会直接被下面的scan接收

        System.out.println("请输入姓名: ");
        String name = scan.nextLine();//读入一行; 单单next则是读到空格为止
        System.out.println("姓名: " + name);

        System.out.println("请输入你的工资: ");
        double salary = scan.nextDouble();
        System.out.println("工资: " + salary);
        scan.close();//scan是个资源,不用了就要关闭
    }
    public static void main2(String[] args) {
        //顺序结构
/*        System.out.println("aaa");
        System.out.println("bbb");
        System.out.println("ccc");*/

        //分支结构
        int score = 2;
        if(score >= 19){
            System.out.println("YOU WIN!");
        }else {
            System.out.println("YOU LOSE!");
        }
        int a = 10;
        int b = 20;
        boolean d = true;
        boolean e = false;
        boolean c = (a > b ? d : e);
        System.out.println(c);
    }
    public static void main1(String[] args) {
        //求100-200之间 既能被3整除，也能被4整除的数字，使用continue
        int i = 100;
        while(i <= 200){
            if(i%3 == 0 && i%4 == 0){
                System.out.println(i);
                i++;
                continue;
            }
            i++;
        }
    }
}

